package test.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import test.form.LoginForm;
import fw.mvc.AbstractAction;
import fw.mvc.IForm;
import fw.mvc.annotation.*;

@Request(path = "/login.do", form = "test.form.LoginForm")
@Result(condition = "success", renderer = "/loginSuccess.jsp")
@Result(condition = "failed", renderer = "/loginFailed.jsp")
public class LoginAction extends AbstractAction {

	@Override
	public String execute(HttpServletRequest req, HttpServletResponse resp,
			IForm form) {
		
		String result = null; 
		LoginForm loginForm = (LoginForm)form;
		if(loginForm.getUserName().equals(loginForm.getPassword())){
			result = "success";
		}else{
			result = "failed";
		}
		
		return result;
	}



}
